
$(function(){
//add change event listener
$('input[name=disk_number_add]').bind('blur',do_estimate);
$('input[name=person_number_add]').bind('blur',do_estimate);
$('input[name=person_number2_add]').bind('blur',do_estimate);
$('input[name=dress_number_add]').bind('blur',do_estimate);
$('input[name=dress_number2_add]').bind('blur',do_estimate);
$('input[name=benzu_customize_price]').bind('blur',do_estimate);
$('.jq_benzustyle').bind('click',do_estimate);
});
var global_doestimater_dispatcher = new Object();
function do_estimate()
{
	$('#lable_total_price').text('estimating...');
	var form = $('#form_main');
	$('input[name=_size_table]').val($.toJSON(global_size_table));
  	$('input[name=_size_frame_table]').val($.toJSON(global_size_frame_table));
  	$('input[name=_gift_table]').val($.toJSON(global_gift_table));
	$('input[name=is_ajax_submit_form]').val('1');
	form.ajaxSubmit({success:_do_estimate_submit_form_cuccess});
}
function _do_estimate_submit_form_cuccess(responseText)
{
	if(responseText.indexOf('ok:') == 0)
	{
		$('#lable_total_price').text(responseText.substring(3));
	}else{
		$('#lable_total_price').text('0');
	}
	$(global_doestimater_dispatcher).trigger('estimate_ajax_back');
}